package org.zjx.state;

import lombok.Data;
import org.zjx.model.game.Pet;

import java.util.ArrayList;
import java.util.List;

@Data
public class PetState implements IDataState {
    private List<Pet> pets;
    private int maxSize;
    private int currentSize;

    public PetState() {
        pets = new ArrayList<>();
    }

    public void addPetName(Pet pet) {
        pets.add(pet);
    }

    public void removePetName(String petName) {
        pets.removeIf(pet -> pet.getName().equals(petName));
    }

    public boolean havePetName(String petName) {
        for (Pet pet : pets) {
            if (pet.getName().equals(petName)) {
                return true;
            }
        }
        return false;
    }
}
